﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using Model;
using System.Data;
using System.Data.OleDb;
namespace DAL
{
    public class MessageDAL
    {
        static string conStr = ConfigurationManager.AppSettings["ConnStr"] + System.Web.HttpContext.Current.Server.MapPath("~/") + ConfigurationManager.AppSettings["dbPath"] + ";";
        public MessageDAL()
        {

        }

        public static bool Add(MessageInfo pi)
        {
            string sql = "insert into message(name,phone,address,email,context,createdate) values('" + pi.name + "','" + pi.phone + "','" + pi.address + "','" + pi.email + "','" + pi.context +"',now())";
            int flag = CommonDAL.ExecuteNonQuery(sql);
            if (flag == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
        public static bool Delete(string ids)
        {
            string sql = "delete from message where id in (" + ids + ")";
            int flag = CommonDAL.ExecuteNonQuery(sql);
            if (flag == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
    }
}
